<template>
	<view class="f26r col313131">
		<navbar background="background-image: linear-gradient(to right, #2c6739, #99c043);"
			title="加盟合作" back @onBack="goBack"
		></navbar>
		<view class="pt20r pl20r pr20r ">
			<view class="p20r backColWhite borRad10r disFlex">
				<view class="w50r">
					<image :src="baseUrl + 'iconHornGreen.png'" mode="aspectFit"
						class="wPer100 h50r"
					></image>
				</view>
				<view class="flex1 pl20r col2c6739">
					<!-- <view class="mb10r"> -->
						信息提交后，平台商会主动和您联系，请填写您常用手机号并保持通话畅通。
					<!-- </view>
					信息提交并审核通过后，可直接使用手机号（账号）及密码登录。 -->
				</view>
			</view>
			<view class="pl20r pr20r backColWhite borRad10r mt20r">
				<view class="lh80r">
					姓名
				</view>
				<input type="text" placeholder="请输入姓名"
					class="h80r f26r" v-model="name"
				>
				<view class="lh80r borT1SE6e6e6">
					联系方式
				</view>
				<input type="text" placeholder="请输入联系方式"
					class="h80r f26r" v-model="phone"
				>
			</view>
		</view>
		<!-- <view class="poFixed bom0 left0 teAliCenter colFff backImgLiGrTR2c6739a99c043 wPer100 lh90r"
			@click="cliSubBtn"
		>
			提交
		</view> -->
		<button :class="['poFixed', 'bom0', 'left0', 'teAliCenter', 'wPer100',
				'lh90r', 'f26r', 'borRad0',
				btnDis ? '' : 'colFff backImgLiGrTR2c6739a99c043'
			]"
			@click="cliSubBtn" :disabled="btnDis"
		>
			{{btnDis ? '已提交' : '提交'}}
		</button>
	</view>
</template>
<script>
import navbar from '@/components/navbar.vue'
import { baseUrl } from '@/utils/request.js'
import { collectData } from '@/utils/api.js'
export default {
	components: { navbar },
	data() {
		return {
			baseUrl,
			// token: '',
			name: '',
			phone: '',
			btnDis: false
		}
	},
	onLoad() {
		// const token = uni.getStorageSync('token');
		// if(token) {
		// 	this.token = token;
		// }else {
		// 	this.token = '';
		// }
		if(uni.getStorageSync('userInfo')) {
			this.phone = uni.getStorageSync('userInfo').phone;
			// console.log(this.userInfo)
		}else {
			this.phone = '';
		}
	},
	methods: {
		goBack() {
			uni.navigateBack();
		},
		cliSubBtn() {
			if(!this.name) return uni.showToast({title: '请输入姓名', icon: 'none', duration: 3000})
			if(!this.phone) return uni.showToast({title: '请输入联系方式', icon: 'none', duration: 3000})
			collectData({
				name: this.name, phone: this.phone, type: 1
			}).then(res => {
				this.btnDis = true;
				uni.showToast({
					title: '提交成功', duration: 3000
				})
			})
		}
	}
}
</script>
<style>
</style>